import fetch from '@/utils/fetch'

export function getDevRoomList(areaId, params) {
	return fetch({
	    url: '/device/v1/mgt/device_room',
	    method: 'get',
		headers: {'x-area-id': areaId},
	    params
  	})
}

export function getDevRoomDetail(id) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}`,
	    method: 'get'
  	})
}

export function getBindedDev(id) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}/device`,
	    method: 'get'
  	})
}

export function bindDev(id, params) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}/device`,
	    method: 'post',
	    params
  	})
}

export function unbindDev(id, params) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}/device`,
	    method: 'delete',
	    params
  	})
}

export function getBindedCamera(id) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}/camera`,
	    method: 'get'
  	})
}

export function bindCamera(id, params) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}/camera`,
	    method: 'post',
	    params
  	})
}

export function unbindCamera(id, params) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}/camera`,
	    method: 'delete',
	    params
  	})
}

export function createDevRoom(data) {
	return fetch({
		url: '/device/v1/mgt/device_room',
		method: 'post',
		data
	})
}

export function modifyDevRoom(id, data) {
	return fetch({
	    url: `/device/v1/mgt/device_room/${id}`,
	    method: 'patch',
	    data
	})
}

// 设备房类型字段说明
export const devRoomTypeList = {
	1: "低压配电房",
	2: "发电机房",
	3: "生活水泵房",
	4: "消防水泵房",
	5: "电梯机房",
	6: "提排泵房",
	7: "公区水电"
};
